package com.wimcorp.magic.cards;

import java.util.Set;

import javax.persistence.Entity;

import com.wimcorp.magic.abilities.Ability;
import com.wimcorp.magic.behaviour.Behaviour;
import com.wimcorp.magic.color.Color;
import com.wimcorp.magic.cost.Cost;

@Entity
public class Planeswalker extends PlayingCard implements Permanent{

	private String type = "Planeswalker";

	
	
	private int loyalty;
	
	protected Planeswalker(){}
	
	public Planeswalker(long multiverseid,String name,String description,Set<Color> colors, Set<Behaviour> behaviours,Set<Ability> abilities,int loyalty,Cost... costs){
		super(multiverseid,name,description,colors,behaviours,abilities,costs);
		this.loyalty = loyalty;
	}
	
	private Planeswalker(PlayingCard card) {
		super(card);
		this.loyalty = ((Planeswalker)card).getLoyalty();
	}
	
	@Override
	protected PlayingCard copy(PlayingCard original) {
		return new Planeswalker(original);
	}

	public String getType() {
		return type;
	}
	

	/*public String toString(){
		StringBuilder card = new StringBuilder(getName());
		card.append("\n");
		card.append(getType());
		card.append(" - ");
		card.append(getSubType());
		card.append("\n");
		card.append(getDescription());
		return card.toString();
	}*/

	
	public void cast() {
		
		
	}
	
	public void addLoyality(int loyalty){
		this.loyalty +=loyalty;
	}
	
	public void subtractLoyality(int loyalty){
		this.loyalty -=loyalty;
		if(this.loyalty <= 0){
			graveyard();
		}
	}


	public int getLoyalty() {
		return loyalty;
	}

	
	
	
	
}
